package com.jrx.anytxn.transaction.job.fileRepay.step;

import com.jrx.anytxn.transaction.entity.TlThirdPartyPayment;
import com.jrx.anytxn.transaction.mapper.ext.ExtTlThirdPartyPaymentMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class FilePreWriter implements ItemWriter<TlThirdPartyPayment> {

    @Resource
    private ExtTlThirdPartyPaymentMapper extTlThirdPartyPaymentMapper;


    @Override
    public void write(List<? extends TlThirdPartyPayment> items) throws Exception {
        if(CollectionUtils.isNotEmpty(items)){
            extTlThirdPartyPaymentMapper.batchInsert((List<TlThirdPartyPayment>)items);
        }

    }
}
